home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / java / io / FileInputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  1.8 KB  |  107 lines

  1. package java.io;
  2.  
  3. import java.nio.channels.FileChannel;
  4. import sun.nio.ch.FileChannelImpl;
  5.  
  6. public class FileInputStream extends InputStream {
  7.    // $FF: renamed from: fd java.io.FileDescriptor
  8.    private FileDescriptor field_0;
  9.    private FileChannel channel;
  10.  
  11.    public FileInputStream(String var1) throws FileNotFoundException {
  12.       this(var1 != null ? new File(var1) : null);
  13.    }
  14.  
  15.    public FileInputStream(File var1) throws FileNotFoundException {
  16.       this.channel = null;
  17.       String var2 = var1 != null ? var1.getPath() : null;
  18.       SecurityManager var3 = System.getSecurityManager();
  19.       if (var3 != null) {
  20.          var3.checkRead(var2);
  21.       }
  22.  
  23.       if (var2 == null) {
  24.          throw new NullPointerException();
  25.       } else {
  26.          this.field_0 = new FileDescriptor();
  27.          this.open(var2);
  28.       }
  29.    }
  30.  
  31.    public FileInputStream(FileDescriptor var1) {
  32.       this.channel = null;
  33.       SecurityManager var2 = System.getSecurityManager();
  34.       if (var1 == null) {
  35.          throw new NullPointerException();
  36.       } else {
  37.          if (var2 != null) {
  38.             var2.checkRead(var1);
  39.          }
  40.  
  41.          this.field_0 = var1;
  42.       }
  43.    }
  44.  
  45.    private native void open(String var1) throws FileNotFoundException;
  46.  
  47.    public native int read() throws IOException;
  48.  
  49.    private native int readBytes(byte[] var1, int var2, int var3) throws IOException;
  50.  
  51.    public int read(byte[] var1) throws IOException {
  52.       return this.readBytes(var1, 0, var1.length);
  53.    }
  54.  
  55.    public int read(byte[] var1, int var2, int var3) throws IOException {
  56.       return this.readBytes(var1, var2, var3);
  57.    }
  58.  
  59.    public native long skip(long var1) throws IOException;
  60.  
  61.    public native int available() throws IOException;
  62.  
  63.    public void close() throws IOException {
  64.       if (this.channel != null) {
  65.          this.channel.close();
  66.       }
  67.  
  68.       this.close0();
  69.    }
  70.  
  71.    public final FileDescriptor getFD() throws IOException {
  72.       if (this.field_0 != null) {
  73.          return this.field_0;
  74.       } else {
  75.          throw new IOException();
  76.       }
  77.    }
  78.  
  79.    public FileChannel getChannel() {
  80.       synchronized(this) {
  81.          if (this.channel == null) {
  82.             this.channel = FileChannelImpl.open(this.field_0, true, false, this);
  83.          }
  84.  
  85.          return this.channel;
  86.       }
  87.    }
  88.  
  89.    private static native void initIDs();
  90.  
  91.    private native void close0() throws IOException;
  92.  
  93.    protected void finalize() throws IOException {
  94.       if (this.field_0 != null) {
  95.          FileDescriptor var10001 = this.field_0;
  96.          if (this.field_0 != FileDescriptor.in) {
  97.             this.close();
  98.          }
  99.       }
  100.  
  101.    }
  102.  
  103.    static {
  104.       initIDs();
  105.    }
  106. }
  107.